# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  include AuthenticatedSystem
  helper :all # include all helpers, all the time
  layout "default"
  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  #protect_from_forgery # :secret => '372ecfdfa19a58d8658401f9a48e7f88'
  
  def google_map_key
    if ENV["RAILS_ENV"] == "development"
      return "ABQIAAAAp3PV0BNeNyRYDZ36D-FVwBTJQa0g3IQ9GZqIMmInSLzwtGDKaBTK9tMRylZIHroQJjGl6sxpcWuNHA"
    elsif ENV["RAILS_ENV"] == "production"
      return "ABQIAAAAp3PV0BNeNyRYDZ36D-FVwBTq19Jkca3WGwtlzjSQ3QVc8o7GhBRRGLDwnxtBzh7MOsepDBjEF8zSrw"
    else
      return "WTF?"
    end
  end

  def authenticate
    begin
      if current_user.login != params[:id]
        redirect_to "/account/login"
      end
    rescue
      redirect_to "/account/login"
    end
  end
end
